<template>
	<!-- 调研 -->
	<view class="research">
		<!-- 商品列表 -->
		<view class="goods-list">
			<view class="product-list">
				<view class="product" v-for="(goods,index) in contentImgUrls" :key="index" @tap="toGoods(goods)">
					<!-- <image mode="widthFix" :src="goods.url"></image> -->
					<image mode="widthFix" src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2716688360,1326705556&fm=27&gp=0.jpg"></image>
					<view class="name">{{goods.title}}</view>
					<view class="info">
						<view class="tag">{{goods.tag}}</view>
						<view class="slogan">{{goods.author}}</view>
					</view>
				</view>
			</view>
			<view class="loading-text">{{loadingText}}</view>
		</view>
	</view>
</template>

<script>
	import {
		researchList
	} from '@/apis/index.js';
	export default {
		data() {
			return {
				contentImgUrls: [],
				loadingText: "正在加载...",
			}
		},
		methods: {
			getList() {
				researchList({
					currentPage: 1,
					perPage: 10
				}).then(res => {
					let [err, data] = res;
					for (const arr of data.data.data) {
						let arrData = {}
						let tagsData = []
						let obj = JSON.parse(arr.tags);
						for (let i in obj) {
							tagsData.push(obj[i])
						}
						arrData.tag = tagsData[0]
						// this.contentList.pic=arr.pic
						arrData.title = arr.title
						arrData.author = arr.author
						this.contentImgUrls.push(arrData)
					}
				})
			},
		},
		mounted() {
			this.getList()
		}
	}
</script>

<style lang="scss" scoped>
	.research {
		height: 100vh;

		.goods-list {
			padding-top: 10px;
			background: #F4F4F4;

			.loading-text {
				width: 100%;
				display: flex;
				justify-content: center;
				align-items: center;
				height: 30px;
				color: #979797;
				font-size: 12px;
			}

			.product-list {
				width: 92%;
				padding: 0 4% 3vw 4%;
				display: flex;
				justify-content: space-between;
				flex-wrap: wrap;

				.product {
					width: 48%;
					border-radius: 5px;
					background-color: #fff;
					margin: 0 0 7px 0;
					box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);

					image {
						width: 100%;
						height: 70px;
						border-radius: 5px 5px 0 0;
					}

					.name {
						width: 92%;
						padding: 5px 4%;
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 2;
						text-align: justify;
						overflow: hidden;
						font-size: 11px;
						height: 28px;
					}

					.info {
						display: flex;
						justify-content: space-between;
						align-items: flex-end;
						width: 92%;
						padding: 5px 4% 5px 4%;
						font-size: 9px;
						color: #757575;
					}
				}

			}
		}
	}
</style>
